package com.hubu.mapper;

import com.hubu.domain.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface UserMapper {
    @Select("select * from user where username = #{username}")
    User getUserByName(@Param("username") String username);

    @Select("select * from user where id = #{id}")
    User getUserById(@Param("id") String id);

    @Update("update user set token = #{key} where id = #{id}")
    void saveToken(@Param("id") Integer id,@Param("key") String key);

    @Select("select username,avatar from user where token = #{token}")
    User getUserByToken(String token);


    Integer register(User user,String avatar);

    Integer checkUsername(String username);
}
